package com.spzx.channel.controller;

import com.github.pagehelper.PageHelper;
import com.spzx.channel.service.IListService;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.web.controller.BaseController;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.common.core.web.page.TableDataInfo;
import com.spzx.product.api.domain.SkuQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Tag(name = "商品详情")
@RestController
@RequestMapping("/list")
public class ListController extends BaseController {

    @Autowired
    private IListService listService;

    /**
     * 商品列表查询
     * @param pageNum
     * @param pageSize
     * @param skuQuery
     * @return
     */
    @Operation(summary = "商品列表查询")
    @GetMapping("/skuList/{pageNum}/{pageSize}")
    public TableDataInfo getList(
            @Parameter(name = "pageNum", description = "当前页码", required = true)
            @PathVariable Integer pageNum,

            @Parameter(name = "pageSize", description = "每页记录数", required = true)
            @PathVariable Integer pageSize,

            @Parameter(name = "productQuery", description = "查询对象", required = false)
            @ModelAttribute SkuQuery skuQuery) {
        return listService.selectProductSkuList(pageNum, pageSize, skuQuery);
    }
}
